
*** recode missing values
replace recpoolf=. if recpoolf==9999999 
replace totfelb=. if totfelb==9999999 
replace totrefb=. if totrefb==9999999 
replace totmisb=. if totmisb==9999999 

replace totadjb=. if totadjb==9999999 
replace totfadjb=. if totfadjb==9999999 
replace totmadjb=. if totmadjb==9999999 
replace agefroff=. if agefroff==9999999
replace refindex=. if refindex==9999999
replace jrefa=0 if jrefa==9999999
replace jfrefa=0 if jfrefa==9999999
replace wrstrefb=. if wrstrefb==9999999 
replace msprior=. if msprior==9999999 
replace mspriora=. if mspriora==9999999 


foreach x in tarrfel tarrfel_both tconvfel_both tconvfel tar_vop tarf_vop tcn_vop tcnf_vop tcnnoprob_vop msoff1yr msadj1yr nxtadrsn nxtprg nxtin wrstrefd offen46d offenad minodte maxodte age{
replace `x'=. if `x'==9999999 
}

** recode variables for which missing means `didn't occur'
foreach x in jadja jfadja  jadjd jrefd jfrefa openadjd {
replace `x'=0 if `x'==9999999 
replace `x'=0 if `x'==. 
}



*** tidy up variables (get rid of duplicates)
decode rlsseq, gen(rlsseq1)
drop rlsseq
encode rlsseq, gen(rlsseq)
drop rlsseq1

